package org.linlinjava.litemall.db.dao;

import java.math.BigDecimal;
import java.util.List;

import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.linlinjava.litemall.db.domain.LitemallGiftCardUserLog;
import org.linlinjava.litemall.db.domain.LitemallGiftCardUserLogExample;

public interface LitemallGiftCardUserLogMapper extends MPJBaseMapper<LitemallGiftCardUserLog> {
    long countByExample(LitemallGiftCardUserLogExample example);

    int deleteByExample(LitemallGiftCardUserLogExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(LitemallGiftCardUserLog record);

    int insertSelective(LitemallGiftCardUserLog record);

    LitemallGiftCardUserLog selectOneByExample(LitemallGiftCardUserLogExample example);

    LitemallGiftCardUserLog selectOneByExampleSelective(@Param("example") LitemallGiftCardUserLogExample example, @Param("selective") LitemallGiftCardUserLog.Column ... selective);

    List<LitemallGiftCardUserLog> selectByExampleSelective(@Param("example") LitemallGiftCardUserLogExample example, @Param("selective") LitemallGiftCardUserLog.Column ... selective);

    List<LitemallGiftCardUserLog> selectByExample(LitemallGiftCardUserLogExample example);

    LitemallGiftCardUserLog selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallGiftCardUserLog.Column ... selective);

    LitemallGiftCardUserLog selectByPrimaryKey(Integer id);

    LitemallGiftCardUserLog selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);

    int updateByExampleSelective(@Param("record") LitemallGiftCardUserLog record, @Param("example") LitemallGiftCardUserLogExample example);

    int updateByExample(@Param("record") LitemallGiftCardUserLog record, @Param("example") LitemallGiftCardUserLogExample example);

    int updateByPrimaryKeySelective(LitemallGiftCardUserLog record);

    int updateByPrimaryKey(LitemallGiftCardUserLog record);

    int logicalDeleteByExample(@Param("example") LitemallGiftCardUserLogExample example);

    int logicalDeleteByPrimaryKey(Integer id);

    @Select("select sum(amount) from litemall_gift_card_user_log \n" +
            "  where card_user_id in(select id from litemall_gift_card_user where gift_card_id in(select id from litemall_gift_card where type = #{type}));")
    BigDecimal getUseAmountByType(@Param("type") int type);
}